package com.aaa.dao;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface S_CheckDao {

    @Update("update news set state=2 where id=#{id}")
    int pass(Integer id);

    @Update("update news set state=3 where id=#{id}")
    int reject(Integer id);

    @Select("SELECT news.id,news.title,news.type,type.`name`,news.`issuer`,news.release_time,news.state,news.content " +
            " from news,type " +
            " where type.id=news.type and state=1  ")
    List<Map> selNews(Map map);

    @Select("<script>select count(id) from news" +
            " where 1=1 <if test=\"id!=null and id!=0\"> and id = #{id}</if></script>")
    Integer getCount(Map map);

    @Select("select * from type")
    List<Map> selName();
}
